export const getItem = (k) => {
  const data = window.sessionStorage.getItem(k)
  try {
    return JSON.parse(data)
  } catch (error) {
    return null
  }
}

export const setItem = (k, v) => {
  if (typeof v === 'object') {
    v = JSON.stringify(v)
  }
  window.sessionStorage.setItem(k, v)
}
// 封装存储本地模块

// 移出数据
export const removeItem = key => {
  if (window.sessionStorage.getItem(key)) {
    window.sessionStorage.removeItem(key)
  }
}
